import request from './request'
import { useUserStore } from '../store/modules/user'
//获取品牌商家列表
export function getListFactory(data) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/getList',
    method: 'post',
    headers: token,
    data,
  })
}
//获取修改品牌商家前的数据查询
export function getBeforeUpdateSelect(id) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/getBeforeUpdateSelect/' + id,
    method: 'get',
    headers: token,
  })
}
//新增或修改品牌商家
export function factorySave(data) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/save',
    method: 'post',
    headers: token,
    data,
  })
}
//新增或修改品牌商家
export function checkFactory(factoryId, checkType) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: `/factory/checkFactory/${factoryId}/${checkType}`,
    method: 'put',
    headers: token,
  })
}
// 根据品牌商家ID获取商家详情
export function getFactoryDetail(id) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/getFactoryDetail/' + id,
    method: 'get',
    headers: token,
  })
}
//保存商家调整余额
export function saveFactoryAdjustMoney(data, id) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/saveFactoryAdjustMoney/' + id,
    method: 'post',
    headers: token,
    data,
  })
}
// 获取商家详情之账号管理
export function getFactoryEmpAccountList(data, id) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/getFactoryEmpAccountList/' + id,
    method: 'post',
    headers: token,
    data,
  })
}
//获取商家详情之结算明细
export function getFactoryOrderModuleSettlementList(data, id) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/getFactoryOrderModuleSettlementList/' + id,
    method: 'post',
    headers: token,
    data,
  })
}
// 获取商家详情之充值记录
export function getFactoryRechargeList(data, id) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/factory/getFactoryRechargeList/' + id,
    method: 'post',
    headers: token,
    data,
  })
}
// 获取品牌厂商全局设置
export function getFactorySet() {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/set/getFactorySet',
    method: 'get',
    headers: token,
  })
}
// 保存厂商设置
export function saveFactorySet(data) {
  const token = {
    'access-token': useUserStore().token,
  }
  return request({
    url: '/set/saveFactorySet',
    method: 'put',
    headers: token,
    data,
  })
}
